<script type="text/javascript" language="javascript">
    (function($) {
        /*whatever jQuery stuff*/
        $(function(){								
            $("#Form").validate({
				ignore: "",
                rules: {
					ads_name: "required",
					ads_vast: "required"
                },
                showErrors: function(errorMap, errorList){
                    var messages='';
                    for (var i = 0; i < errorList.length; i++) {					
                        messages += '- '+errorList[i].message+'\n';
                    }
                    if(messages) alert("<?php echo lang('requirement');?>: \n"+"¯¯¯¯¯¯¯¯¯¯ \n"+ messages);
                    //this.defaultShowErrors();
                } ,
                submitHandler: function(e){
					$('.ajax-loading',e).css('visibility','visible');
					//Send Form
					document.forms["Form"].submit();
                },
                onfocusout: false,
                onkeyup: false,
				onclick: false,					
                messages: {
					ads_name: "<?php echo lang('ads_name');?>",
					ads_vast: "<?php echo lang('ads_vast');?>"	
                }
            });		
			//DateTime Picker
			$('.datetime').datetimepicker({
				dateFormat:'dd/mm/yy',
				timeFormat:'hh:mm',
				separator:' ',
			    changeMonth : true,
			    changeYear : true,
			    yearRange: 'c+nn:+1y',
			    //yearRange: '+1M +10D',
				minDate: -100,
			    maxDate: '-1d',
				showHour: true,		
				showMinute: true,
				showTime: true		
			});				
        });
    })(jQuery);
</script>
<div class="wrap">
 	<div id="icon-index" class="icon32"><br /></div><h2><?php echo ucwords(str_replace('_',' ',$this->uri->segment(1)));?> &raquo; <?php echo ucwords(str_replace('_',' ',$this->uri->segment(2)));?> &raquo; <?php echo lang($this->uri->segment(3));?></h2>
</div>
<div id="wpbody-content">
    <div class="metabox-holder" id="dashboard-widgets">
		<div class="tablenav top">
			<div class="alignleft"><input type="button" value="<?php echo lang('button_back');?>" class="button-primary" onclick="javascript:history.go(-1);"/></div>
		</div>	
            <div class="inside">			
				<form id="Form" method="post" action="" name="Form">
					<table border="0" cellspacing="0" cellpadding="0" class="form-table">
						<tbody>	
						<tr>
							<th scope="row"><?php echo lang('ads_name');?></th>
							<td><input type="text" name="ads_name" id="ads_name" class="medium-text" /></td>
						</tr>
						<tr>
							<th scope="row"><?php echo lang('ads_avaliable');?></th>
							<td>
								<input type="checkbox" name="is_music" id="is_music" value="1" checked="checked"/> <?php echo lang('is_music');?>&nbsp;
								<input type="checkbox" name="is_video" id="is_video" value="1" checked="checked"/> <?php echo lang('is_video');?>&nbsp;
								<input type="checkbox" name="is_movie" id="is_movie" value="1" checked="checked"/> <?php echo lang('is_movie');?>
							</td>
						</tr>						
						<tr>
							<th scope="row"><?php echo lang('period_date');?></th>
							<td>
								<?php echo lang('ads_from');?>
									<input type="text" name="start_date" id="start_date" class="medium-text datetime" value="<?php echo date('d/m/Y H:i');?>" readonly="readonly"/>
								<?php echo lang('ads_to');?>
									<input type="text" name="end_date" id="end_date" class="medium-text datetime" value="<?php echo date('d/m/Y H:i',strtotime(date("Y-m-d")."23:59:00 +1 days"));?>" readonly="readonly"/>
							</td>
						</tr>
						<tr>
							<th scope="row"><?php echo lang('ads_vast');?></th>
							<td>
								<textarea name="ads_vast" id="ads_vast" rows="5" class="regular-text"></textarea>
							</td>
						</tr>
						<tr>
							<th scope="row"><?php echo lang('ads_weight');?></th>
							<td><input type="text" name="ads_weight" id="ads_weight" class="small-text" value="1"/></td>
						</tr>
						<tr>
							<th scope="row"><?php echo lang('ads_impression');?></th>
							<td><input type="text" name="ads_impression" id="ads_impression" class="medium-text" value="0"/></td>
						</tr>
						<tr>
							<th scope="row"><?php echo lang('limit_per_day');?></th>
							<td><input type="text" name="limit_per_day" id="limit_per_day" class="small-text" value="0"/></td>
						</tr>														
						<tr>
							<th scope="row">&nbsp;</th>
							<td><p class="submit"><input type="submit" value="<?php echo lang('button_add');?>" class="button-primary" />&nbsp;<img alt="" class="ajax-loading" src="<?php echo css_asset_url('images/wpspin_light.gif'); ?>" /></p></td>
						</tr>								
						</tbody>
					</table>
					<div class="tablenav bottom"></div>
				</form>
            </div><!-- wpbody inside -->
    </div><!-- wpcontent -->
</div><!-- wpbody-content -->